# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=emacs-jabber
pkgver=0_git20240306
_gitrev=633cb73633143ec093c291af94b008f456037e8b
pkgrel=0
_pkgreal=jabber
pkgdesc="Jabber/XMPP client for Emacs"
url="https://codeberg.org/emacs-jabber/emacs-jabber"
arch="noarch"
license="GPL-2.0-or-later"
depends="
	cmd:emacs
	emacs-fsm
	emacs-srv
	"
makedepends="emacs-nox"
source="$pkgname-$_gitrev.tar.gz::https://codeberg.org/emacs-jabber/emacs-jabber/archive/$_gitrev.tar.gz"
builddir="$srcdir/$pkgname/lisp"

prepare() {
	default_prepare
	cp -v ../jabber-ourversion.el .
}

build() {
	emacs -batch -q -no-site-file -L . \
		-eval '(setq print-length nil load-prefer-newer t)' \
		-f batch-byte-compile \
		./*.el
}

check() {
	local tests="load-all.el skip-tag-forward.el history.el
			jabberd.el nick-change-fail.el
			caps-hash.el parse-next-stanza.el
			"

	export top_builddir="$builddir"
	local test; for test in $tests; do
		msg "Running tests from $test"

		emacs -batch -q -no-site-file -L . \
			-L ../tests -l "../tests/$test"
	done
}

package() {
	install -Dvm644 ./*.el ./*.elc \
		-t "$pkgdir"/usr/share/emacs/site-lisp/$_pkgreal/

	cd "$pkgdir"/usr/share/emacs/site-lisp/$_pkgreal
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
8891c9707c5cc463a4a1dcf2355c4122a4df82b0609bb8b8734588873f72fb571210050c2824fef7176ab79c107c5549e6ef58bfe57f59f7aa1faae774073254  emacs-jabber-633cb73633143ec093c291af94b008f456037e8b.tar.gz
"
